package com.uriuniv.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.SimpleFormController;

import com.uriuniv.command.LoginCommand;
import com.uriuniv.domain.Student;
import com.uriuniv.service.StudentS;

public class LoginC extends SimpleFormController {

	private StudentS studentS;
	
	public void setStudentS(StudentS studentS) {
		this.studentS = studentS;
	}

	@Override
	protected ModelAndView onSubmit(HttpServletRequest request,
			HttpServletResponse response, Object command, BindException errors)
			throws Exception {
		
		LoginCommand loginCommand = (LoginCommand)command;
		
		HttpSession session = request.getSession();
		session.setAttribute("loginId", loginCommand.getEmail());
		
		return super.onSubmit(request, response, command, errors);
	}
	
}
